package com.dubbo.controller;

import com.dubbo.common.check.CheckUtil;
import com.dubbo.domain.User;
import com.dubbo.service.business.wallet.WalletService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;


/**
 * 钱包
 * @author lihongwu
 * 2019年1月9日 下午2:23:31
 */
@RestController
@RequestMapping("/wallet")
public class WalletController {
	
	@Autowired
	private WalletService walletService;
	
	/**
	 * 获取代理商加盟金
	 *
	 * @author lihongwu
	 * 2019年1月9日 下午2:31:22
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@PostMapping("/getWalletMoney")
	public Map<String,Object> getWalletMoney(HttpServletRequest request) throws Exception{
		User user = (User) CheckUtil.checkOline3(request);
		return walletService.getWalletMoney(user);
	}
	
	/**
	 * 获取加盟金记录
	 *
	 * @author lihongwu
	 * 2019年1月25日 下午4:49:42
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@PostMapping("/getWalletDetail")
	public Map<String,Object> getWalletDetail(HttpServletRequest request,Long pageStart,Long pageTotal) throws Exception{
		User user = (User) CheckUtil.checkOline3(request);
		return walletService.getWalletDetail(user,pageStart,pageTotal);
	}
}
